<template>
	<view>
		<view class="all">
			<view class="top" @click="toaddress()">
				<image class="left" src="../../../static/img/three.png" mode=""></image>
				<view class="center">
					<view style="display: flex; margin: 0px 0 10px 0;">
						<view class="one">
							王小二
						</view>
						<view class="two">
							13193509419
						</view>
					</view>
					<view>
						河南省郑州市二七区1313
					</view>
				</view>
				<image class="right" src="../../../static/img/abck.png" mode=""></image>
			</view>
			<view class="top2">
				<view class="top">
					<image class="left1" src="../../../static/img/indexListItem.png" mode=""></image>
					<view class="center1">
						<view>
							名称
						</view>
						<view class="s1">
							￥178.00
						</view>
					</view>
					<view class="right1">
						<u-number-box v-model="value"></u-number-box>
					</view>
				</view>
				<view class="list flex_sp">
					<view class="left2">
						服务商家
					</view>
					<view class="right2">
						商家名称
					</view>
				</view>
				<view class="list flex_sp" @click="show=true">
					<view class="left2">
						服务时间
					</view>
					<view class="right2 flex">
						<input type="text" disabled="disabled" v-model="date" />
						<image style="width: 12px;height: 12px;" src="../../../static/img/abck.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="top2">
				<view class="list flex_sp" @click="youhuijuan()">
					<view class="left2">
						优惠卷
					</view>
					<image style="width: 12px;height: 12px;" src="../../../static/img/abck.png" mode=""></image>
				</view>
				<view class="list flex_sp">
					<view class="left2">
						备注
					</view>
					<view class="right2 flex">
						<input type="text" disabled="disabled" />
						<image style="width: 12px;height: 12px;" src="../../../static/img/abck.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="title">
				支付方式
			</view>
			<view class="top3" v-for="(item , index) in body" :key="index">
				<view class="flex">
					<image style="width: 24px;height: 24px;margin: 0 10px;" :src="item.url" mode="">
					</image>
					<text>{{item.name}}</text>
				</view>
			</view>
		</view>
		<view class="last flex_sp">
			<view class="left4 flex">
				合计：<text>￥300</text>
			</view>
			<view class="right4">
				立即支付
			</view>
		</view>
		<view>
			<u-datetime-picker :show="show" v-model="value1" mode="datetime" @cancel="show=false"
				@confirm="firm"></u-datetime-picker>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				value: 0,
				body: [{
						name: "微信支付",
						url: "../../../static/img/wxpay.png"
					},
					{
						name: "余额支付",
						url: "../../../static/img/pay.png"
					}
				],
				show: false,
				value1: Number(new Date()),
				date: ""
			};
		},
		onShow() {
			//获取优惠卷返回
			uni.$on('upyouhui', function(data) {
				console.log(data.i);
				console.log(data.price);
			})
			//获取地址返回
			uni.$on('upaddress', function(data) {
				console.log(data);
			})
		},
		onLoad(option) {
			console.log(option);
		},
		methods: {
			//去地址
			toaddress() {
				uni.navigateTo({
					url: '/pages/index/addresslist/addresslist?chose=' + 1
				})
			},
			//去优惠卷
			youhuijuan() {
				uni.navigateTo({
					url: '/pages/youhuijuan/youhuijuan?car=' + 1
				})
			},
			//时间弹窗确认
			firm(e) {
				const data = new Date(e.value)
				const year = data.getFullYear()
				const month = data.getMonth()
				const day = data.getDate()
				const houers = data.getHours()
				const minuts = data.getMinutes()
				const s = data.getSeconds()
				const date = year + "-" + month + "-" + day + "-" + houers + "-" + minuts + "-" + s
				this.show = false
				this.date = date
			}
		}
	}
</script>

<style lang="scss" scoped>
	.last {
		position: fixed;
		bottom: 0;
		background-color: #fff;
		width: 100%;
		padding: 10px 10px 20px 10px;
		box-sizing: border-box;

		.left4 {
			font-size: 14px;
			font-weight: bold;
			color: #333333;

			text {
				font-size: 24px;
				font-weight: 900;
				color: #FB774B;
			}
		}

		.right4 {
			text-align: center;
			padding: 5px 10px;
			background: #FB774B;
			border-radius: 40px;
			font-size: 14px;
			font-weight: bold;
			color: #FFFFFF;
		}
	}

	.all {
		padding: 15px;
		background-color: #f5f5f5;
		min-height: 100vh;

		.title {
			font-size: 15px;
			font-weight: bold;
			color: #000000;
			margin: 10px 0;
		}

		.top3 {
			background: #FFFFFF;
			border-radius: 10px;
			padding: 10px;
			// display: flex;
			// align-items: center;
			margin: 10px 0;
			font-size: 13px;
			font-weight: bold;
			color: #666666;
		}

		.top2 {
			background: #FFFFFF;
			border-radius: 10px;
			margin: 10px 0;

			.list {
				padding: 15px;
				border-bottom: 1px solid #eeeeee;

				.left2 {
					font-size: 14px;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #333333;
					width: 50%;
				}

				.right2 {
					font-size: 14px;
					font-weight: bold;
					color: #333333;

					input {
						font-size: 14px;
						font-weight: 400;
						color: #cccccc;
					}
				}
			}
		}

		.top {
			background: #FFFFFF;
			border-radius: 10px;
			padding: 15px;
			display: flex;
			align-items: center;
			// justify-content: space-between;
			margin: 10px 0;

			.left {
				width: 14px;
				height: 14px;
				margin: 0 10px;
			}

			.center {
				flex: 1;
				margin: 0 10px;
				font-size: 14px;
				font-weight: 400;
				color: #333333;
			}

			.right {
				width: 16px;
				height: 16px;
			}

			.left1 {
				width: 60px;
				height: 60px;
			}

			.center1 {
				flex: 1;
				margin-left: 10px;
				font-size: 14px;
				font-weight: bold;
				color: #333333;

				.s1 {
					margin-top: 10px;
					font-size: 16px;
					font-weight: 900;
					color: #FB774B;
				}
			}

			.right1 {
				flex: 1;
			}
		}
	}
</style>